{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2142be9e-460c-45af-88aa-d356954b0caa",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pygwalker as pyg\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7384b136-9098-482d-8914-1663547dc6ae",
   "metadata": {},
   "outputs": [],
   "source": [
    "df = pd.read_csv(\"https://kanaries-app.s3.ap-northeast-1.amazonaws.com/public-datasets/bike_sharing_dc.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "45cbe3c8-6606-498b-a741-455425798cc9",
   "metadata": {},
   "outputs": [],
   "source": [
    "pyg.component(df).bar().encode(x=\"season\", y=\"sum(casual)\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "cf5f40ff-a2ed-44c6-9f85-d633b75fa020",
   "metadata": {},
   "outputs": [],
   "source": [
    "component = pyg.component(df)\n",
    "component_0 = component.encode(x=\"season\", y=\"sum(casual)\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a98cf2a9-5286-4f4a-9279-d51a69d166bb",
   "metadata": {},
   "outputs": [],
   "source": [
    "component_0.bar()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d81d0c87-4c6f-42f8-8d22-8b32fc61384f",
   "metadata": {},
   "outputs": [],
   "source": [
    "component_0.area()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b5f1b05a-4b43-4f73-9558-1ce2edae81a3",
   "metadata": {},
   "outputs": [],
   "source": [
    "component_0.line()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9d8f9721-688f-4ade-aaaa-577be9bda56a",
   "metadata": {},
   "outputs": [],
   "source": [
    "component_0.trail()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "901ecec4-cddc-4b74-afac-c82a7c52e98e",
   "metadata": {},
   "outputs": [],
   "source": [
    "component.scatter().encode(x=\"feeling_temp\", y=\"temperature\", color=\"humidity\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "98bb748f-0aaf-4b43-acbe-0524eafe10af",
   "metadata": {},
   "outputs": [],
   "source": [
    "component.circle().encode(x=\"feeling_temp\", y=\"temperature\", color=\"humidity\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "80c52a23-b3e3-4957-860f-21dd80b6ef47",
   "metadata": {},
   "outputs": [],
   "source": [
    "(\n",
    "component\n",
    " .rect()\n",
    " .encode(x='bin(\"feeling_temp\", 6)', y='bin(\"temperature\", 6)', color=\"MEAN(humidity)\")\n",
    " .layout(height=400, width=460)\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4cbf2edb-8bef-4190-986f-62b48517e7f4",
   "metadata": {},
   "outputs": [],
   "source": [
    "component.arc().encode(theta=\"SUM(registered)\", color=\"season\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f622848b-6122-4ee4-a7b1-d8521520b63f",
   "metadata": {},
   "outputs": [],
   "source": [
    "component_0.bar().explorer()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "aafdd3b4-6819-480f-9c34-70c8d1aa410e",
   "metadata": {},
   "outputs": [],
   "source": [
    "component_0.profiling()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "bff819f3-209d-4a78-b723-103b70dfb2a5",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
